import service from "@/utils/fetch";

const post = {
  //查询商品表分页
  sku_list(params) {
    return service({
      method: "get",
      params,
      url: "/api/sku/",
    });
  },

  // 新增商品表
  sku_add(params) {
    return service({
      method: "post",
      data: params,
      url: "/api/sku/",
    });
  },

  // 修改商品表
  sku_update(params) {
    return service({
      method: "put",
      data: params,
      url: "/api/sku/",
    });
  },

  // 删除商品表
  sku_delete(params) {
    return service({
      method: "delete",
      data: params,
      url: "/api/sku/",
    });
  },

  // 查询商品表详情
  sku_detail(id) {
    return service({
      method: "get",
      url: "/api/sku/" + id,
    });
  },

  // 审核商品表

  sku_check(params) {
    return service({
      method: "post",
      url: "/api/sku/check",
      data: params,
    });
  },

  // 上架商品表
  sku_on(data) {
    return service({
      method: "post", 
      data: data,
      url: `/api/sku/on/`,
    });
  },

  // 下架商品表
  sku_off(data) {
    return service({
      method: "post", 
      data: data,
      url: `/api/sku/off/`,
    });
  },

  // 商品批量推荐   
  sku_recommendList(data) {
    return service({
      method: "post",
      data: data,
      url: `/api/sku/recommendList`,
    });
  },

  // 商品批量取消推荐
  sku_cancelRecommendList(data) {
    return service({
      method: "post",
      data: data,
      url: `/api/sku/cancelRecommendList`,
    });
  },

  // 修改商品库存
  sku_skuStock(data) {
    return service({
      method: "put",
      data: data,
      url: `/api/sku/skuStock`,
    });
  },
};

export default post;
